import api from './api';

// 用户注册
export const register = async (data: {
  phone: string;
  password: string;
  verify_code: string;
  nickname?: string;
}) => {
  return api.post('/auth/register', data);
};

// 用户登录
export const login = async (data: {
  phone: string;
  password: string;
}) => {
  return api.post('/auth/login', data);
};

// 获取用户信息
export const getUserInfo = async () => {
  return api.get('/auth/user-info');
};

// 更新用户信息
export const updateUserInfo = async (data: {
  nickname?: string;
  avatar?: string;
  gender?: number;
  birthYear?: number;
  birthMonth?: number;
  birthDay?: number;
  birthHour?: number;
}) => {
  return api.put('/auth/user-info', data);
};

// 修改密码
export const changePassword = async (data: {
  oldPassword: string;
  newPassword: string;
}) => {
  return api.put('/auth/change-password', data);
};
